package com.tinyseed.emcp.api.productionRule.repository;

import com.tinyseed.emcp.api.productionRule.entity.Reduction;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * 版权所有 © Copyright 2019<br>
 *
 * @Description: <br>
 * @CreateDate: Created in 2019/11/2 16:18 <br>
 * @Author: Simon.Yu
 * @Modify:
 */
public interface ReductionRepository extends JpaRepository<Reduction, Long>, JpaSpecificationExecutor<Reduction> {

    @Query(value = "select * from users u where u.username = :username ", nativeQuery = true)
    Reduction findByUsername(@Param("username") String username);

    void deleteReductionsByIdIsIn(@Param("ids") Long[] ids);

    List<Reduction> getAllByActiveEquals(Long isActive);

}
